/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.bean;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author elvis
 */
@Entity
@Table(name = "AREA")
@NamedQueries({@NamedQuery(name = "AreaTO.findByCodArea", query = "SELECT a FROM AreaTO a WHERE a.codArea = :codArea"), @NamedQuery(name = "AreaTO.findByDescArea", query = "SELECT a FROM AreaTO a WHERE a.descArea = :descArea")})
public class AreaTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "COD_AREA", nullable = false)
    private Long codArea;
    @Column(name = "DESC_AREA", nullable = false)
    private String descArea;
    @OneToMany(mappedBy = "codArea")
    private Collection<SeccionTO> seccionTOCollection;

    public AreaTO() {
    }

    public AreaTO(Long codArea) {
        this.codArea = codArea;
    }

    public AreaTO(Long codArea, String descArea) {
        this.codArea = codArea;
        this.descArea = descArea;
    }

    public Long getCodArea() {
        return codArea;
    }

    public void setCodArea(Long codArea) {
        this.codArea = codArea;
    }

    public String getDescArea() {
        return descArea;
    }

    public void setDescArea(String descArea) {
        this.descArea = descArea;
    }

    public Collection<SeccionTO> getSeccionTOCollection() {
        return seccionTOCollection;
    }

    public void setSeccionTOCollection(Collection<SeccionTO> seccionTOCollection) {
        this.seccionTOCollection = seccionTOCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codArea != null ? codArea.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AreaTO)) {
            return false;
        }
        AreaTO other = (AreaTO) object;
        if ((this.codArea == null && other.codArea != null) || (this.codArea != null && !this.codArea.equals(other.codArea))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "licencias_dto.AreaTO[codArea=" + codArea + "]";
    }

}
